package myapp.com.xm.myapplication;

import android.content.Context;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v4.view.NestedScrollingChild;
import android.support.v4.view.NestedScrollingChildHelper;
import android.support.v7.widget.RecyclerView;
import android.util.AttributeSet;
import android.util.Log;
import android.view.MotionEvent;

public class RecyclerView1 extends RecyclerView {
    private Boolean sonView = false;
    private NestedScrollingChildHelper mChildHelper;

    public RecyclerView1(@NonNull Context context) {
        super(context);
        init();
    }

    public RecyclerView1(@NonNull Context context, @Nullable AttributeSet attrs) {
        super(context, attrs);
        init();
    }

    public RecyclerView1(@NonNull Context context, @Nullable AttributeSet attrs, int defStyle) {
        super(context, attrs, defStyle);
        init();
    }

    public void getSonView(boolean sonView) {
        this.sonView = sonView;
    }

//    @Override
//    public boolean dispatchTouchEvent(MotionEvent ev) {
//        //父层ViewGroup不要拦截点击事件
//        getParent().requestDisallowInterceptTouchEvent(true);
//        return super.dispatchTouchEvent(ev);
//    }


//    @Override
//    public boolean onInterceptTouchEvent(MotionEvent ev) {
////        if(sonView){
////            return true  && super.onInterceptTouchEvent(ev);
////        }else{
////            return false && super.onInterceptTouchEvent(ev);
////        }
//        getParent().requestDisallowInterceptTouchEvent(true);
//        return super.onInterceptTouchEvent(ev);
//    }

    @Override
    public boolean onTouchEvent(MotionEvent event) {
        Log.e("111","son:onTouchEvent");
        return super.onTouchEvent(event);
    }

    private void init() {

    }


}
